using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._NetworkAnalystTools._Analysis
{
    /// <summary>
    /// <para>Calculate Locations</para>
    /// <para>Locates input features on a network and adds fields describing these network locations  to the input features. The tool is used to store the network location information as feature attributes to quickly load the features as inputs for a network analysis.</para>
    /// <para>定位网络上的输入要素，并将描述这些网络位置的字段添加到输入要素中。该工具用于将网络位置信息存储为要素属性，以便快速加载要素作为网络分析的输入。</para>
    /// </summary>    
    [DisplayName("Calculate Locations")]
    public class CalculateLocations : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CalculateLocations()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_point_features">
        /// <para>Input Features</para>
        /// <para><xdoc>
        ///   <para>The input features for which the network locations will be calculated.</para>
        ///   <para>For line and polygon features, since the network location information is stored in a BLOB field (specified in the Location Ranges Field parameter), only geodatabase feature classes are supported.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将计算其网络位置的输入要素。</para>
        ///   <para>对于线和面要素，由于网络位置信息存储在 BLOB 字段（在位置范围字段参数中指定）中，因此仅支持地理数据库要素类。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_network_dataset">
        /// <para>Input Analysis Network</para>
        /// <para><xdoc>
        ///   <para>The network dataset that will be used to calculate the locations.</para>
        ///   <para>If a sublayer of a network analysis layer is used as input features, the parameter is automatically set to the network dataset referenced by the network analysis layer.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于计算位置的网络数据集。</para>
        ///   <para>如果将网络分析图层的子图层用作输入要素，则参数将自动设置为网络分析图层所引用的网络数据集。</para>
        /// </xdoc></para>
        /// </param>
        public CalculateLocations(object _in_point_features, object _in_network_dataset)
        {
            this._in_point_features = _in_point_features;
            this._in_network_dataset = _in_network_dataset;
        }
        public override string ToolboxName => "Network Analyst Tools";

        public override string ToolName => "Calculate Locations";

        public override string CallName => "na.CalculateLocations";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_point_features, _in_network_dataset, _search_tolerance, _search_criteria, _match_type.GetGPValue(), _source_ID_field, _source_OID_field, _position_field, _side_field, _snap_X_field, _snap_Y_field, _distance_field, _snap_Z_field, _location_field, _exclude_restricted_elements.GetGPValue(), _search_query, _out_point_feature_class, _travel_mode];

        /// <summary>
        /// <para>Input Features</para>
        /// <para><xdoc>
        ///   <para>The input features for which the network locations will be calculated.</para>
        ///   <para>For line and polygon features, since the network location information is stored in a BLOB field (specified in the Location Ranges Field parameter), only geodatabase feature classes are supported.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将计算其网络位置的输入要素。</para>
        ///   <para>对于线和面要素，由于网络位置信息存储在 BLOB 字段（在位置范围字段参数中指定）中，因此仅支持地理数据库要素类。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_point_features { get; set; }


        /// <summary>
        /// <para>Input Analysis Network</para>
        /// <para><xdoc>
        ///   <para>The network dataset that will be used to calculate the locations.</para>
        ///   <para>If a sublayer of a network analysis layer is used as input features, the parameter is automatically set to the network dataset referenced by the network analysis layer.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于计算位置的网络数据集。</para>
        ///   <para>如果将网络分析图层的子图层用作输入要素，则参数将自动设置为网络分析图层所引用的网络数据集。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Analysis Network")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_network_dataset { get; set; }


        /// <summary>
        /// <para>Search Tolerance</para>
        /// <para><xdoc>
        ///   <para>The search tolerance that will be used to locate the input features on the network. Features that are outside the search tolerance are left unlocated. The parameter includes a value and units for the tolerance.</para>
        ///   <para>The default is 5000 meters.</para>
        ///   <para>The parameter is not used when calculating locations for line or polygon features.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于在网络上定位输入要素的搜索容差。超出搜索容差范围的要素将处于未定位状态。该参数包括公差的值和单位。</para>
        ///   <para>默认值为 5000 米。</para>
        ///   <para>计算线要素或面要素的位置时，不使用该参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string _search_tolerance { get; set; } = "5000 Meters";


        /// <summary>
        /// <para>Search Criteria</para>
        /// <para><xdoc>
        ///   <para>The sources in the network dataset that will be searched when calculating network locations and the portions of geometry (also known as snap types) that will be used. For example, if the network dataset references separate feature classes representing streets and sidewalks, you can choose to locate inputs on streets but not on sidewalks.</para>
        ///   <para>The following are the available snap type choices for each network source:
        ///   <bulletList>
        ///     <bullet_item>SHAPE—The point will locate on the closest point of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>MIDDLE—The point will locate on the closest midpoint of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>END—The point will locate on the closest endpoint of an element in this network source.  </bullet_item><para/>
        ///     <bullet_item>NONE—The point will not locate on elements in this network source.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>The MIDDLE and END options are maintained for backward compatibility. Use the SHAPE option to locate your inputs on a particular network source; otherwise, use NONE.</para>
        ///   <para>When calculating locations for line or polygon features, only the SHAPE snap type is used, even if other snap types are specified.</para>
        ///   <para>The default value is SHAPE for all network sources except override junctions created by running the Dissolve Network tool and system junctions, which have a default of NONE.</para>
        ///   <para>This parameter is not used when the network data source is a portal service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>计算网络位置时将搜索的网络数据集中的源以及将使用的几何部分（也称为捕捉类型）。例如，如果网络数据集引用了表示街道和人行道的单独要素类，则可以选择在街道上定位输入，但不在人行道上定位输入。</para>
        /// <para>以下是每个网络源的可用快照类型选项：
        ///   <bulletList>
        ///     <bullet_item>SHAPE—该点将位于此网络源中元素的最近点上。</bullet_item><para/>
        ///     <bullet_item>MIDDLE—该点将位于此网络源中元素的最近中点。</bullet_item><para/>
        ///     <bullet_item>END - 该点将位于此网络源中元素的最近端点上。</bullet_item><para/>
        ///     <bullet_item>NONE—该点不会位于此网络源中的元素上。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>保留 MIDDLE 和 END 选项以实现向后兼容性。使用 SHAPE 选项在特定网络源上查找输入;否则，请使用 NONE。</para>
        ///   <para>计算线要素或面要素的位置时，即使指定了其他捕捉类型，也仅使用 SHAPE 捕捉类型。</para>
        ///   <para>所有网络源的默认值均为 SHAPE，但运行“融合网络”工具创建的覆盖联结和系统联结除外，默认值为 NONE。</para>
        ///   <para>当网络数据源是门户服务时，不使用此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Criteria")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _search_criteria { get; set; } = null;


        /// <summary>
        /// <para>Find Closest among All Classes</para>
        /// <para>This parameter is only available via Python.</para>
        /// <para>此参数仅通过 Python 提供。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Find Closest among All Classes")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _match_type_value _match_type { get; set; } = _match_type_value._true;

        public enum _match_type_value
        {
            /// <summary>
            /// <para>MATCH_TO_CLOSEST</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("MATCH_TO_CLOSEST")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>PRIORITY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("PRIORITY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Source ID Field</para>
        /// <para>The name of the field to be created or updated with the source ID of the computed network location. A field named SourceID will be created or updated by default.</para>
        /// <para>使用计算网络位置的源 ID 创建或更新的字段的名称。默认情况下，将创建或更新名为 SourceID 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Source ID Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _source_ID_field { get; set; } = null;


        /// <summary>
        /// <para>Source OID Field</para>
        /// <para>The name of the field to be created or updated with the source OID of the computed network location. A field named SourceOID will be created or updated by default.</para>
        /// <para>要使用计算网络位置的源 OID 创建或更新的字段的名称。默认情况下，将创建或更新名为 SourceOID 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Source OID Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _source_OID_field { get; set; } = null;


        /// <summary>
        /// <para>Percent Along Field</para>
        /// <para>The name of the field to be created or updated with the percent along with the computed network location. A field named PosAlong will be created or updated by default.</para>
        /// <para>要创建或更新的字段的名称，其中包含百分比以及计算的网络位置。默认情况下，将创建或更新名为 PosAlong 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Percent Along Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _position_field { get; set; } = null;


        /// <summary>
        /// <para>Side of Edge Field</para>
        /// <para>The name of the field to be created or updated with the side of edge on which the point feature is located on the computed network location. A field named SideOfEdge will be created or updated by default.</para>
        /// <para>要创建或更新的字段的名称，以及点要素在计算网络位置上所在的边的一侧。默认情况下，将创建或更新名为 SideOfEdge 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Side of Edge Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _side_field { get; set; } = null;


        /// <summary>
        /// <para>Located X-Coordinate Field</para>
        /// <para>The name of the field to be created or updated with the x-coordinate of the computed network location. A field named SnapX will be created or updated by default.</para>
        /// <para>使用计算网络位置的 x 坐标创建或更新的字段的名称。默认情况下，将创建或更新名为 SnapX 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Located X-Coordinate Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _snap_X_field { get; set; } = null;


        /// <summary>
        /// <para>Located Y-Coordinate Field</para>
        /// <para>The name of the field to be created or updated with the y-coordinate of the computed network location. A field named SnapY will be created or updated by default.</para>
        /// <para>要使用计算网络位置的 y 坐标创建或更新的字段的名称。默认情况下，将创建或更新名为 SnapY 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Located Y-Coordinate Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _snap_Y_field { get; set; } = null;


        /// <summary>
        /// <para>Distance from Feature Field</para>
        /// <para><xdoc>
        ///   <para>The name of the field to be created or updated with the distance of the point feature from the computed network location. A field named Distance is created or updated by default.</para>
        ///   <para>The output field is in meters.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要创建或更新的字段的名称，以及点要素与计算网络位置的距离。默认情况下，将创建或更新名为“距离”的字段。</para>
        ///   <para>输出字段以米为单位。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Distance from Feature Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _distance_field { get; set; } = null;


        /// <summary>
        /// <para>Located Z-Coordinate Field</para>
        /// <para>The name of the field to be created or updated with the z-coordinate of the computed network location. A field named SnapZ will be created or updated by default.</para>
        /// <para>要使用计算网络位置的 z 坐标创建或更新的字段的名称。默认情况下，将创建或更新名为 SnapZ 的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Located Z-Coordinate Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _snap_Z_field { get; set; } = null;


        /// <summary>
        /// <para>Location Ranges Field</para>
        /// <para>The name of the field to be created or updated with the location ranges of the computed network locations for the line or polygon features. A field named Locations will be created or updated by default.</para>
        /// <para>使用线或面要素的计算网络位置的位置范围创建或更新的字段名称。默认情况下，将创建或更新名为“位置”的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Location Ranges Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _location_field { get; set; } = null;


        /// <summary>
        /// <para>Exclude Restricted Portions of the Network</para>
        /// <para>This parameter is only available via Python.</para>
        /// <para>此参数仅通过 Python 提供。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Exclude Restricted Portions of the Network")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _exclude_restricted_elements_value _exclude_restricted_elements { get; set; } = _exclude_restricted_elements_value._true;

        public enum _exclude_restricted_elements_value
        {
            /// <summary>
            /// <para>EXCLUDE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("EXCLUDE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>INCLUDE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCLUDE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Search Query</para>
        /// <para><xdoc>
        ///   <para>Defines a query that will restrict the search to a subset of the features in a source feature class. This is useful if you don't want to locate on features that may be unsuitable for your analysis. For example, you can use the query to exclude all features with a particular road class.</para>
        ///   <para>A separate SQL expression can be specified per source feature class of the network dataset. By default, no query is used for any source.</para>
        ///   <para>This parameter is not used when the network data source is a portal service.</para>
        ///   <para>The SQL expression for a given network source is specified by selecting the source name in the Name column and using the SQL expression builder in the Query column. For more information on SQL syntax, see SQL reference for query expressions used in ArcGIS.</para>
        ///   <para>Any network source not explicitly specified in the tool dialog box will have no query applied.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义一个查询，该查询将搜索限制为源要素类中要素的子集。如果您不想查找可能不适合分析的要素，这将非常有用。例如，您可以使用查询排除具有特定道路类的所有要素。</para>
        ///   <para>可以为网络数据集的每个源要素类指定单独的 SQL 表达式。默认情况下，不对任何源使用查询。</para>
        ///   <para>当网络数据源是门户服务时，不使用此参数。</para>
        ///   <para>通过在“名称”列中选择源名称，然后在“查询”列中使用 SQL 表达式生成器来指定给定网络源的 SQL 表达式。有关 SQL 语法的详细信息，请参阅 ArcGIS 中使用的查询表达式的 SQL 参考。</para>
        ///   <para>任何未在工具对话框中显式指定的网络源都不会应用查询。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Query")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _search_query { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Features</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_point_feature_class { get; set; }


        /// <summary>
        /// <para>Travel Mode</para>
        /// <para><xdoc>
        ///   <para>The name of the travel mode to be used in the analysis.</para>
        ///   <para>If you select a travel mode, the travel mode settings, such as restrictions and impedance attributes, will be considered when calculating location fields. For example, if the closest network edge to one of your input points is forbidden to trucks and your travel mode is set for trucking, Calculate Locations will locate the point on the next-closest network edge that is not forbidden for trucks.</para>
        ///   <para>The available travel modes depend on the Input Analysis Network parameter value.</para>
        ///   <para>If a sublayer of a network analysis layer is used as input features, the travel mode parameter must be set to the network analysis layer's travel mode.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要在分析中使用的出行模式的名称。</para>
        ///   <para>如果选择出行模式，则在计算位置字段时将考虑出行模式设置，例如限制和阻抗属性。例如，如果卡车禁止使用与其中一个输入点最近的网络边，并且您的出行模式设置为卡车运输，则计算位置将定位卡车未禁止的下一个最近的网络边缘上的点。</para>
        ///   <para>可用的出行模式取决于输入分析网络参数值。</para>
        ///   <para>如果将网络分析图层的子图层用作输入要素，则必须将出行模式参数设置为网络分析图层的出行模式。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Travel Mode")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _travel_mode { get; set; } = null;


        public CalculateLocations SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}